{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Text generation skill"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>text</th>\n",
       "      <th>completion_target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Imagine a fusion of traditional retail with vi...</td>\n",
       "      <td>In this futuristic retail scenario, customers ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Draft a message to shareholders highlighting o...</td>\n",
       "      <td>Dear valued shareholders, As we look ahead, ou...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Describe the office of the future in a post-pa...</td>\n",
       "      <td>The office of the future is a hybrid space tha...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>How can we integrate AI into our customer serv...</td>\n",
       "      <td>Integrating AI into customer service can be ac...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Provide a vision statement for a tech company ...</td>\n",
       "      <td>Empowering every individual, no matter their l...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Suggest a strategy to improve employee wellnes...</td>\n",
       "      <td>Promote regular digital detox hours, provide e...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>How can businesses benefit from embracing bloc...</td>\n",
       "      <td>By adopting blockchain, businesses can achieve...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Draft a mission statement for a startup focuse...</td>\n",
       "      <td>Transforming discarded materials into timeless...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Propose an innovative method for businesses to...</td>\n",
       "      <td>Harness augmented reality (AR) to create immer...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>How can companies ensure data privacy in the a...</td>\n",
       "      <td>Companies can adopt zero-knowledge proofs, dec...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                text  \\\n",
       "0  Imagine a fusion of traditional retail with vi...   \n",
       "1  Draft a message to shareholders highlighting o...   \n",
       "2  Describe the office of the future in a post-pa...   \n",
       "3  How can we integrate AI into our customer serv...   \n",
       "4  Provide a vision statement for a tech company ...   \n",
       "5  Suggest a strategy to improve employee wellnes...   \n",
       "6  How can businesses benefit from embracing bloc...   \n",
       "7  Draft a mission statement for a startup focuse...   \n",
       "8  Propose an innovative method for businesses to...   \n",
       "9  How can companies ensure data privacy in the a...   \n",
       "\n",
       "                                   completion_target  \n",
       "0  In this futuristic retail scenario, customers ...  \n",
       "1  Dear valued shareholders, As we look ahead, ou...  \n",
       "2  The office of the future is a hybrid space tha...  \n",
       "3  Integrating AI into customer service can be ac...  \n",
       "4  Empowering every individual, no matter their l...  \n",
       "5  Promote regular digital detox hours, provide e...  \n",
       "6  By adopting blockchain, businesses can achieve...  \n",
       "7  Transforming discarded materials into timeless...  \n",
       "8  Harness augmented reality (AR) to create immer...  \n",
       "9  Companies can adopt zero-knowledge proofs, dec...  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.DataFrame([\n",
    "    {\"text\": \"Imagine a fusion of traditional retail with virtual reality. Describe the customer experience.\", \"completion_target\": \"In this futuristic retail scenario, customers wear VR headsets as they enter physical stores. They can instantly see personalized recommendations, virtual try-ons, and immersive product demos, blending the tactile benefits of in-person shopping with the endless possibilities of the digital realm.\"},\n",
    "    \n",
    "    {\"text\": \"Draft a message to shareholders highlighting our commitment to sustainable practices.\", \"completion_target\": \"Dear valued shareholders, As we look ahead, our commitment to sustainable and eco-friendly practices remains unwavering. We understand the critical importance of conserving our planet for future generations and are continually implementing innovative solutions to reduce our carbon footprint and promote ethical operations.\"},\n",
    "    \n",
    "    {\"text\": \"Describe the office of the future in a post-pandemic world.\", \"completion_target\": \"The office of the future is a hybrid space that seamlessly integrates remote and in-person work. Enhanced with smart technology, it's equipped for virtual collaborations and is adaptable to individual needs, prioritizing health, safety, and flexibility.\"},\n",
    "    \n",
    "    {\"text\": \"How can we integrate AI into our customer service without losing the human touch?\", \"completion_target\": \"Integrating AI into customer service can be achieved by using chatbots for routine queries and ensuring human agents handle more complex or emotional issues. Training AI with empathy in responses, while always providing an option for customers to connect with a human, can strike the right balance.\"},\n",
    "    \n",
    "    {\"text\": \"Provide a vision statement for a tech company aiming to bridge the digital divide in rural areas.\", \"completion_target\": \"Empowering every individual, no matter their location, with equal and unhindered access to the digital realm, we strive to erase boundaries and create a universally connected world.\"},\n",
    "    \n",
    "    {\"text\": \"Suggest a strategy to improve employee wellness in remote working conditions.\", \"completion_target\": \"Promote regular digital detox hours, provide ergonomic home office equipment subsidies, organize virtual fitness sessions, and ensure frequent mental health check-ins and resources to cultivate a culture of well-being.\"},\n",
    "    \n",
    "    {\"text\": \"How can businesses benefit from embracing blockchain technology?\", \"completion_target\": \"By adopting blockchain, businesses can achieve enhanced data security, improved supply chain transparency, efficient and transparent transactions, reduced fraud, and can tap into new models like token economies.\"},\n",
    "    \n",
    "    {\"text\": \"Draft a mission statement for a startup focused on upcycling waste materials into high-end fashion.\", \"completion_target\": \"Transforming discarded materials into timeless fashion, we're not just designing clothing, but pioneering a movement. Our mission is to redefine luxury with sustainability at its heart.\"},\n",
    "    \n",
    "    {\"text\": \"Propose an innovative method for businesses to retain customers in an increasingly competitive digital market.\", \"completion_target\": \"Harness augmented reality (AR) to create immersive product experiences. Allow customers to virtually 'experience' products in their real environment before purchasing, bridging the gap between the digital and physical worlds.\"},\n",
    "    \n",
    "    {\"text\": \"How can companies ensure data privacy in the age of big data and AI?\", \"completion_target\": \"Companies can adopt zero-knowledge proofs, decentralized data storage, regularly audit AI algorithms for bias, maintain transparent data policies, and educate users about their data rights to ensure robust data privacy.\"}\n",
    "])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Applying skill: text_generation\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Applying skill: text_generation\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█| 10/10 [00:31<00:00\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>text</th>\n",
       "      <th>completion_target</th>\n",
       "      <th>text_generation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Imagine a fusion of traditional retail with vi...</td>\n",
       "      <td>In this futuristic retail scenario, customers ...</td>\n",
       "      <td>As you enter the store, you are immediately tr...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Draft a message to shareholders highlighting o...</td>\n",
       "      <td>Dear valued shareholders, As we look ahead, ou...</td>\n",
       "      <td>Dear Shareholders,\\n\\nAs we approach the end o...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Describe the office of the future in a post-pa...</td>\n",
       "      <td>The office of the future is a hybrid space tha...</td>\n",
       "      <td>The office of the future in a post-pandemic wo...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>How can we integrate AI into our customer serv...</td>\n",
       "      <td>Integrating AI into customer service can be ac...</td>\n",
       "      <td>Integrating AI into customer service can be a ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Provide a vision statement for a tech company ...</td>\n",
       "      <td>Empowering every individual, no matter their l...</td>\n",
       "      <td>At our tech company, we envision a world where...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Suggest a strategy to improve employee wellnes...</td>\n",
       "      <td>Promote regular digital detox hours, provide e...</td>\n",
       "      <td>One strategy to improve employee wellness in r...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>How can businesses benefit from embracing bloc...</td>\n",
       "      <td>By adopting blockchain, businesses can achieve...</td>\n",
       "      <td>Businesses can benefit greatly from embracing ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Draft a mission statement for a startup focuse...</td>\n",
       "      <td>Transforming discarded materials into timeless...</td>\n",
       "      <td>At our startup, we are committed to revolution...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Propose an innovative method for businesses to...</td>\n",
       "      <td>Harness augmented reality (AR) to create immer...</td>\n",
       "      <td>One innovative method for businesses to retain...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>How can companies ensure data privacy in the a...</td>\n",
       "      <td>Companies can adopt zero-knowledge proofs, dec...</td>\n",
       "      <td>In today's digital age, data privacy has becom...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                text  \\\n",
       "0  Imagine a fusion of traditional retail with vi...   \n",
       "1  Draft a message to shareholders highlighting o...   \n",
       "2  Describe the office of the future in a post-pa...   \n",
       "3  How can we integrate AI into our customer serv...   \n",
       "4  Provide a vision statement for a tech company ...   \n",
       "5  Suggest a strategy to improve employee wellnes...   \n",
       "6  How can businesses benefit from embracing bloc...   \n",
       "7  Draft a mission statement for a startup focuse...   \n",
       "8  Propose an innovative method for businesses to...   \n",
       "9  How can companies ensure data privacy in the a...   \n",
       "\n",
       "                                   completion_target  \\\n",
       "0  In this futuristic retail scenario, customers ...   \n",
       "1  Dear valued shareholders, As we look ahead, ou...   \n",
       "2  The office of the future is a hybrid space tha...   \n",
       "3  Integrating AI into customer service can be ac...   \n",
       "4  Empowering every individual, no matter their l...   \n",
       "5  Promote regular digital detox hours, provide e...   \n",
       "6  By adopting blockchain, businesses can achieve...   \n",
       "7  Transforming discarded materials into timeless...   \n",
       "8  Harness augmented reality (AR) to create immer...   \n",
       "9  Companies can adopt zero-knowledge proofs, dec...   \n",
       "\n",
       "                                     text_generation  \n",
       "0  As you enter the store, you are immediately tr...  \n",
       "1  Dear Shareholders,\\n\\nAs we approach the end o...  \n",
       "2  The office of the future in a post-pandemic wo...  \n",
       "3  Integrating AI into customer service can be a ...  \n",
       "4  At our tech company, we envision a world where...  \n",
       "5  One strategy to improve employee wellness in r...  \n",
       "6  Businesses can benefit greatly from embracing ...  \n",
       "7  At our startup, we are committed to revolution...  \n",
       "8  One innovative method for businesses to retain...  \n",
       "9  In today's digital age, data privacy has becom...  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from adala.agents import Agent\n",
    "from adala.skills import TransformSkill\n",
    "\n",
    "agent = Agent(\n",
    "    skills=TransformSkill(\n",
    "        name='text_generation',\n",
    "        instructions='Generate text.',\n",
    "        input_template='Text: {text}',\n",
    "        output_template='Output: {text_generation}'\n",
    "    )\n",
    ")\n",
    "\n",
    "agent.run(df)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "adala",
   "language": "python",
   "name": "adala"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
